<?php defined('SEJUJOPEFDNGJSL') or exit('Access denied');?>
<div class="">
	<?php require("topbut.php") ?>
	<!-- 改成表格开始 -->
	<div class="panel panel-inverse">
		<div class="panel-heading">
			<h4 class="panel-title">锁仓记录</h4>
		</div>
		<div class="panel-body">
			<div class="table-responsive">
				<table class="table table-striped givetable">
					<tr>
						<th>序号</th>
						<!--<th>订单编号</th>-->
						<th>锁仓类型</th>
						<th>套餐</th>
						<th>锁仓数量</th>
						<th>预计收益</th>
						<th>实际收益</th>
						<th>锁仓时间</th>
						<th>到期时间</th>
						<th>状态</th>

						<th>操作</th>
					</tr>
					<?php
						//帮助表中根据未收取收益 会员id 来查询数据
						$db->query("select a.*,(case when a.type=1 then 'VIC' when a.type = 2 then '锁仓收益' when a.type = 3 then '团队收益' else 'VIC利息动态' end) as types,(case when a.status=0 then '锁仓中' when a.status =1 then '已完成' when a.status =2 then '已取消' else '未知' end) as statuss,b.title,b.meal,b.days from ld_lock_log as a left join ld_set_meal as b on a.pid = b.id  where a.uid = ".$_userid." order by a.id desc");
						$give_help = $db->rs;
						$hrarr = array();
						$tmparr = array();
/*
						foreach($give_help as $val){
							$tmparr['id'] = $val['id'];
							$tmparr['amount'] = $val['amount'];     //提供帮助金额
							$tmparr['color'] = "red";
							if(time()-$val['give_help_time']>10*24*3600){   //10天之后解冻
								$tmparr['color'] = "rgb(24,162,94)";
							}
							if($val['xf_type']==1){
								$tmparr['jylx'] = "VIC";
							}elseif($val['xf_type']==2){
								$tmparr['jylx'] = "锁仓收益";
							}elseif($val['xf_type']==3){
								$tmparr['jylx'] = "团队收益";
							}else{
								$tmparr['jylx'] = "PBC利息动态";
							}
							$tmparr['benifit_times'] = $val['benifit_times'];
							$tmparr['benifit_amount'] = $val['benifit_amount'];
							$tmparr['tcdays'] = $val['tcdays'];
							$tmparr['status'] = $val['status'];
							$tmparr['tctype'] = $val['tctype'];
							$tmparr['ctime'] = $val['give_help_time'];
							$tmparr['timetime'] = date("Y-m-d H:i:s",$val['give_help_time']);
							$tmparr['order_no'] = get_help_no("give",$val['uname'],$val['give_help_no']);  //订单编号
							array_push($hrarr,$tmparr);
							$tmparr = array();
						}*/
						?>
						<?php
						$xuhao=0;
						if(!empty($give_help)){
							foreach($give_help as $k => $v){
								$xuhao++;
						?>
						<tr>
							<td><?php print_r($xuhao); ?></td>
							<!--<td><?php //echo $carr['order_no'];?></td>-->
							<td><?php echo $v['types']; ?></td>
							<td><?php echo $v['title']; ?></td>
							<td style="color:red;"><?php echo $v['nums']; ?></td>
							<td>
								<?php print('日息'.($v['meal']*100).'%'); ?></td>
							<td><?php print($v['mum']); ?></td>
							<td><?php echo date('Y-m-d H:i:s',$v['add_time']); ?></td>
							<td><?php echo date('Y-m-d H:i:s',$v['end_date']); ?></td>
							<td>
							<?php echo $v['statuss']; ?>
							</td>

							<td><!--<a href="/home.php?lsact=lixilist&pid=<?php //echo $carr['id']; ?>">查看</a>-->
								<?php
								if($v['status']==0 && $v['pid'] != 6){
									?>
									<button onclick="tiben(<?php echo $v['id']; ?>)" style="outline: none;border-radius: 3px;background:rgb(49,160,230);color: #fff;border: none;padding: 2px 7px;">解锁</button>
									<?php
								}
								?>

							</td>

						</tr>
					<?php
						}
					}
					?>
				</table>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
layer.config({
  skin:'layer-ext-moon',
  extend:'skin/moon/style.css'
});
function closeAll(){
  layer.closeAll();
}
function tiben(id){
	// layer.alert(id);
	  var index = layer.load(0, {shade: [0.5,'#8F8F8F']});
      var ajaxTimeoutTest =$.ajax({
      type: "get",
      dataType: "json",
      timeout : 13000,
      url: "/ajax.php?act=tiben&id="+id,
      success: function(data){
        if(data.status==0){
          layer.alert(data.tips, function(index){
              layer.closeAll();
          });

        }else{
          layer.alert(data.tips, function(index){
              window.location.href="home.php?lsact=shouyi";
          });

        }

      },
      error: function(){

      },
      complete : function(XMLHttpRequest,status){ //请求完成后最终执行参数
　　　　　       if(status=='timeout'){//超时,status还有success,error等值的情况
 　　　　　      ajaxTimeoutTest.abort();
        layer.alert('现在人多请稍后重试，不要刷新页面，请重新提交！', function(index){
              layer.closeAll();
          });

　　　　     }
　　　　　 }
      });
}

</script>
<div class="layer_fellow" style="display: none;">
<h4><span onclick="closeAll();" style="float:right;cursor:pointer;font-weight:normal;">关闭</span></h4>
  <?php for($i=0;$i<20;$i++){?>
  <div style="margin-top:20px;" id="helper_nick_name<?php echo $i?>"></div>
  <div id="helper_account<?php echo $i?>"></div>
  <?php }?>
</div>